#include "scene_graph_manager.h"
#include "scene_graph.h"

using namespace krryn::scene;

void scene_graph_manager::attach(scene_graph_node_base *a_Node){
	m_Nodes[a_Node->get_node_name()] = a_Node;
}

scene_graph_node_base *scene_graph_manager::create(const std::string &a_Id, const std::string &a_NodeName){
	if(m_Nodes[a_NodeName] == 0) return 0;

	scene_graph_node_base *l_Node = m_Nodes[a_NodeName]->create(a_Id);
	l_Node->init();
	return l_Node;
}

scene_graph_manager *scene_graph_manager::get_instance(){
	static scene_graph_manager *l_Manager = 0;

	if(l_Manager == 0){
		l_Manager = new scene_graph_manager();
	}

	return l_Manager;
}
